#include"ScoreTarget.h"
#include "File.h"
#include "Factory.h"
#include "ReportError.h"
#include "PlayState.h"


ScoreTarget::ScoreTarget()
{
	m_goalScore = -1;
	m_ballNum = -1;
}

bool ScoreTarget::Load(File* const f)
{
	if(!f->GetInteger(&m_goalScore))
	{
		ReportError("ScoreTarget::Load goalScore not found");
	}
	if(!f->GetInteger(&m_ballNum))
	{
		ReportError("ScoreTarget::Load ballNum not found");
	}
	ThePlayState::Instance()->SetTargetScore(m_goalScore);
	ThePlayState::Instance()->SetTotalBalls(m_ballNum);

	return true;
}

void ScoreTarget::Update()
{

}

const char* ScoreTarget::GetTypeName()
{
	return "ScoreTarget";
}

GameObject* CreateScoreTarget()
{
	return new ScoreTarget;
}

static bool sT = TheGameObjectFactory::Instance()->AddToMap("ScoreTarget", CreateScoreTarget);